package com.itheima02;

/**
 * @author Xiao
 * @date 2021/7/10
 */
public class AnimalTest {
    public static void main(String[] args) {
        Animal panghu = new Cat("胖虎",2);    //多态 → 向下转型
        Animal wangcai = new Dog("旺财",3);   //多态 → 向下转型
        panghu.eat();
        Cat panghu1 = (Cat) panghu;     //多态 → 向上转型
        panghu1.playgame();
        System.out.println("------------");
        wangcai.eat();
        ((Dog)wangcai).watchHouse();    //多态 → 向上转型
    }
}
